﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using System.Web.Http.ModelBinding;
using Bigger.Base.Pipeline;
using Bigger.Web.WebApi;

namespace Bigger.Study.Web.Controllers
{
    public class ValuesController : ApiMessageController
    {
        // GET api/values
        public object Get([FromUri]ApiPackage objApiPackage)
        {
            return ApiMessageConfig(objApiPackage, "WebApiCommonApiMessageGet");
        }

        // GET api/values/5
        public object Get(int id, [FromUri]ApiPackage objApiPackage)
        {
            return ApiMessageConfig(objApiPackage, "WebApiCommonCacheApiMessage");
        }

        // POST api/values/5
        public object Post([FromBody]ApiPackage objApiPackage)
        {
            //Mvc对于字典空的值的解析为空字符串
            //WebApi对于字典空的值的解析为null
            return ApiMessageConfig(objApiPackage, "WebApiCommonApiMessagePost");
        }

        // PUT api/values/5
        public void Put(int id, [FromBody]string value)
        {
        }

        // DELETE api/values/5
        public void Delete(int id)
        {
        }

        public IHttpActionResult Get()
        {
            return Jsonp(new Bigger.Framework.InvokeResult());
        }
    }
}
